package com.ang.juc.n1;

public class Test2 {
    static class MyRunnable implements Runnable{
        @Override
        public void run() {
            System.out.println("MyRunnable启动..."+Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        MyRunnable myRunnable = new MyRunnable();

        Thread thread1 = new Thread(myRunnable);
        thread1.setName("thread1");
        thread1.start();

        Thread thread2 = new Thread(myRunnable,"thread2");
        thread2.start();

        new Thread(()->{
            System.out.println("MyRunnable启动..."+Thread.currentThread().getName());
        },"thread3").start();
    }
}
